package cn.miui.mall.service.impl;

import cn.miui.mall.dao.Userdao;
import cn.miui.mall.pojo.userinfo;
import cn.miui.mall.service.Userservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Userserviceimpl implements Userservice {
    @Autowired
    private Userdao userdao;

    @Override
    public userinfo findbyId(Integer id) {
        return userdao.findById(id).orElse(null);
    }
    @Override
    public List<userinfo> findAll() {
        return userdao.findAll();
    }

    @Override
    public boolean sava(userinfo userinfo) {
        if (userdao.save(userinfo)==null) {
            return false;
        }
        return true;
    }

    @Override
    public userinfo findByusernameAndUserpassword(String username, String password) {
        return userdao.findByusernameAndUserpassword(username,password);
    }


}
